#ifndef GLOBALCONNECTIONMANAGER_H
#define GLOBALCONNECTIONMANAGER_H

#include <QObject>
#include "commondef.h"
#include "connection/connection.h"
#include "datatransfer.h"

class GlobalConnectionManager : public QObject
{
    Q_OBJECT
public:
    explicit GlobalConnectionManager(QObject *parent = 0);
    void sendData(QIODevice *from, sockTypes to);
private:
    Connection *connections[4];
    DataTransfer *transfer;

signals:
    void sendEnd();

public slots:
    void readData(sockTypes type,const QByteArray &data);
    void newConnection(Connection *pConnection);
    void removeConnection(Connection *pConnection);

    void transferEnd(bool isError);
};

extern GlobalConnectionManager globManager;
#endif // GLOBALCONNECTIONMANAGER_H
